﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.inspectionMaterial
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtsubmitUid.Text))
			{
				strErr+="提交人格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtout_storage_detail_Id.Text))
			{
				strErr+="巡检物料ID格式错误！\\n";	
			}
			if(this.txtsubmitQuestion.Text.Trim().Length==0)
			{
				strErr+="提交问题不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtsubmitTime.Text))
			{
				strErr+="提交时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtcheckUid.Text))
			{
				strErr+="审核人、巡检任务分发人格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtdealUid.Text))
			{
				strErr+="处理人格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtdealStatus.Text))
			{
				strErr+="处理状态格式错误！\\n";	
			}
			if(this.txtdealResult.Text.Trim().Length==0)
			{
				strErr+="处理结果不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtdealTime.Text))
			{
				strErr+="处理时间格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtuseMoney.Text))
			{
				strErr+="处理费用格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int submitUid=int.Parse(this.txtsubmitUid.Text);
			int out_storage_detail_Id=int.Parse(this.txtout_storage_detail_Id.Text);
			string submitQuestion=this.txtsubmitQuestion.Text;
			DateTime submitTime=DateTime.Parse(this.txtsubmitTime.Text);
			int checkUid=int.Parse(this.txtcheckUid.Text);
			int dealUid=int.Parse(this.txtdealUid.Text);
			int dealStatus=int.Parse(this.txtdealStatus.Text);
			string dealResult=this.txtdealResult.Text;
			DateTime dealTime=DateTime.Parse(this.txtdealTime.Text);
			decimal useMoney=decimal.Parse(this.txtuseMoney.Text);

			lcs.Model.inspectionMaterial model=new lcs.Model.inspectionMaterial();
			model.submitUid=submitUid;
			model.out_storage_detail_Id=out_storage_detail_Id;
			model.submitQuestion=submitQuestion;
			model.submitTime=submitTime;
			model.checkUid=checkUid;
			model.dealUid=dealUid;
			model.dealStatus=dealStatus;
			model.dealResult=dealResult;
			model.dealTime=dealTime;
			model.useMoney=useMoney;

			lcs.BLL.inspectionMaterial bll=new lcs.BLL.inspectionMaterial();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
